package com.vinny.springbootflowable2.model.enums;

import lombok.Getter;

@Getter
public enum ExpenseStatus {
    SUBMITTED("SUBMITTED", "已提交"),
    APPROVED("APPROVED", "已通过"),
    REJECTED("REJECTED", "已驳回");

    private final String code;
    private final String desc;

    ExpenseStatus(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static ExpenseStatus fromCode(String code) {
        if (code == null) {
            throw new IllegalArgumentException("Status code cannot be null");
        }
        for (ExpenseStatus status : ExpenseStatus.values()) {
            if (status.getCode().equals(code.toUpperCase())) {
                return status;
            }
        }
        throw new IllegalArgumentException("Invalid expense status code: " + code);
    }
} 